home *** CD-ROM | disk | FTP | other *** search
/ CD Concept 6 / CD Concept 06.iso / mac / UTILITAIRE / Survival 6.0.2 / Macros / Compute.Macro next >
Encoding:
Text File  |  1995-01-27  |  1.2 KB  |  36 lines  |  [TEXT/MJUA]

  1. MACRO 'Compute';
  2.  
  3. var
  4. status,time,grade,i,index,row,col,vars:integer;
  5. meanTime:real;
  6.  
  7. begin
  8. reset;
  9.     GETDATA('HD516:Pascal Development:Survival 6.0:Data:Ejemplo.surv');
  10.     GET(row,col,vars);{get number of rows columns and selected vars}
  11.     status:= 1;{column location of status var in the data matrix}
  12.  time:= 2; {column location of time var in the data matrix}
  13.  
  14. {first data is transformed with standard Pascal commands. Long execution time}
  15. {notice that data is accessed with the custom gDATA[] array definition.      }
  16.  
  17. meanTime:= 0.0;
  18. for i:= 0 to row - 1 do
  19.      begin
  20.         index:= i * col; {access to the start of the ith row of data matrix}
  21.      meanTime:= meanTime + gDATA[index + time]; {compute average time}
  22.         if gDATA[index + status] = 0 then gDATA[index + status] := -1;
  23.   end;
  24. meanTime:= meanTime/row;
  25. WRITE('The average time of the series is :',meanTime);
  26.  
  27. {now data is transformed with a custom COMPUTE command.Short execution time }
  28. {notice that data is accessed with the custom rDATA[] array definition.     }
  29.     COMPUTE
  30.         if rData[2] > 0 then rDATA[2] := rData[4] * rData[5];
  31.      rData[3]:= -(rData[1]);
  32.     {you may add any other transform statement below}
  33.     END;{end of COMPUTE command}
  34.  {LIST(6,0); List data with format length = 6, decimal point = 0}
  35. end;{end of MACRO}
  36.